import React from 'react'
import { useNavigate } from 'react-router-dom'

export default function A() {
  const navigate = useNavigate()
  return (
    <div>
      A
      <br />
      <button
        onClick={() => {
          // setTimeout(() => {
          navigate('/about/123?xxx=111&yyy=222', {
            // replace: true, //替换历史记录
            // state: 数据
            state: { name: 'zs' },
          })
          // navigate(-1) //类似于history.go方法
          // }, 2000)
        }}
      >
        编程式导航
      </button>
    </div>
  )
}
